package com.g17.virtualpetbackend.service;

import com.g17.virtualpetbackend.entity.Record;
import com.g17.virtualpetbackend.repo.RecordRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class RecordService {

    @Autowired
    private RecordRepository recordRepository;

    public Record findRecordByPetName(String petName){
        return recordRepository.findByPetName(petName);
    }

    public Optional<Record> findRecordById(Long id){
        return recordRepository.findById(id);
    }

    public List<Record> findRecordByKeyword(String keyword){
        return recordRepository.findByKeyword(keyword);
    }

    public Record createRecord(String petName, String masterName, String diseaseName, String species, String symptom, List<String> symptomPicture, String symptomVideo, String diagnose, String treatment, String medicine, String followup, List<String> followupPicture, String followupVideo, String doctor){
        return recordRepository.createRecord(petName, masterName, diseaseName, species, symptom, symptomPicture, symptomVideo, diagnose, treatment, medicine, followup, followupPicture, followupVideo, doctor);
    }

    public Record updateRecord(Long id, String petName, String masterName, String diseaseName, String species, String symptom, List<String> symptomPicture, String symptomVideo, String diagnose, String treatment, String medicine, String followup, List<String> followupPicture, String followupVideo, String doctor){
        return recordRepository.updateRecord(id, petName, masterName, diseaseName, species, symptom, symptomPicture, symptomVideo, diagnose, treatment, medicine, followup, followupPicture, followupVideo, doctor);
    }

    public Record deleteRecordById(Long id){
        return recordRepository.deleteRecordById(id);
    }

    public List<Record> findAllRecords(){
        return recordRepository.findAllRecords();
    }

    public Record findSingleRecord(Long id){
        return recordRepository.findSingleRecord(id);
    }
}
